package com.llkj.qingnianguoxue.adapter;

import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.llkj.qingnianguoxue.R;
import com.llkj.qingnianguoxue.bean.ReportReasonBean;

import java.util.List;

/**
 * 举报原因适配器
 */
public class ReportReasonAdapter extends BaseQuickAdapter<ReportReasonBean, BaseViewHolder> {

    private int mCurrentPosition;
    public ReportReasonAdapter(int layoutResId, List<ReportReasonBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder baseViewHolder, ReportReasonBean item) {
        baseViewHolder.setText(R.id.tvReasonTitle, item.getContent());

        ImageView ivSelect = baseViewHolder.getView(R.id.ivReasonCheck);
        if(mCurrentPosition==baseViewHolder.getLayoutPosition()){
            ivSelect.setSelected(true);
        }else {
            ivSelect.setSelected(false);
        }
    }

    public void setSelectChecked(int postion){
        mCurrentPosition = postion;
        notifyDataSetChanged();
    }

    public int getCheckPosition(){
        return mCurrentPosition;
    }
}
